<?php get_header(); ?>

<?php
global $authordata;
$aOptions         = SofaSuppaStore::initOptions( false );
$disable_comments = $aOptions[ 'disable_comments' ];
?>

<!-- main content start -->

<div class="grid_8">

	<?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    
    <div class="castshadow grid_8 clearfix alpha omega">
    
    <!-- title start -->

    <h1><?php the_title(); ?></h1>
    
    <!-- title end -->
    
    <!-- post meta start -->
    
    <span class="sidenewsinfo small clearfix">
    <?php the_time( get_option( 'date_format' ) ); ?> 
    &bull; 
    <?php echo sprintf( __( 'Posted by <a href="%s">%s</a> in', 'sofa_suppastore' ), get_author_posts_url( $authordata->ID, $authordata->user_nicename ), get_the_author() ); ?> <?php the_category( ', ' ); ?>
    &bull; 
    <?php the_tags(); ?>
    <?php 
	if( $disable_comments == 'no' ) {
		echo ' &bull; ';
		comments_popup_link( '0 ' . __( "comments", "sofa_suppastore" ), '1 ' . __( "comment", "sofa_suppastore" ), '% ' . __( "comments", "sofa_suppastore" ) ); 
	}
	?>
    </span>
    
    <span class="underline clearfix">&nbsp;</span>
    
    <!-- post meta end -->
    
    <!-- content start -->
    
    <?php 
    $content = get_the_content();
    $content = apply_filters( 'the_content', $content );
    $content = str_replace( ']]>', ']]&gt;', $content );
    $content = preg_replace( '|(class=[\'"]wp-caption.*?[\'"]).*?(style=[\'"](.*?)[\'"]).*?|i', '$1', $content );
    echo $content; 
	$p_page = __( "Previous page", "sofa_suppastore" );
	$n_page = __( "Next page", "sofa_suppastore" );
	wp_link_pages( array( 'before' => '<div id="pagination" class="wp-pagenavi grid_8 alpha omega"><span class="nava">', 'next_or_number' => 'next', 'previouspagelink' => $p_page, 'nextpagelink' => $n_page, 'after' => '</span></div>' ) );
	?>
    
    <!-- content end -->
    
    </div>

	<?php endwhile; ?>
    
    <!-- comments -->
    <?php if( 'open' == $post->comment_status && $disable_comments == 'no' ) comments_template(); ?>
    <!-- end comments -->
    
    <?php else : ?>
    
    <!-- no content start -->

	<div class="grid_8 clearfix">
    
        <h1><?php _e( "Nothing found!", "sofa_suppastore" ); ?></h1>
        <p><?php _e( "Sorry but no posts found. Take your time, there's gonna be soon to see something listed here.", "sofa_suppastore" ); ?></p>
    
    </div>
    
    <!-- no content end -->

	<?php endif; ?>
    
</div>

<!-- main content end -->

<!-- include sidebar start -->

    <?php get_template_part( 'sidebar_single' ); ?>
    
<!-- include sidebar end -->

<?php get_footer(); ?>